# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sed
pkgver=4.9
pkgrel=2
pkgdesc="GNU stream editor"
url="https://www.gnu.org/software/sed"
arch="all"
license="GPL-3.0-or-later"
install="$pkgname.post-deinstall"
makedepends="perl"
checkdepends="diffutils coreutils"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/pub/gnu/sed/sed-$pkgver.tar.xz"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-i18n \
		--disable-nls
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	rm -rf "$pkgdir"/usr/lib/charset.alias || true
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}

sha512sums="
36157a4b4a2430cf421b7bd07f1675d680d9f1616be96cf6ad6ee74a9ec0fe695f8d0b1e1f0b008bbb33cc7fcde5e1c456359bbbc63f8aebdd4fedc3982cf6dc  sed-4.9.tar.xz
"
